<?php
namespace app\blog\controller;
use cmf\controller\AdminBaseController;
use think\Db;

class StatisController extends AdminBaseController
{
    //店铺每天总营业额统计
    public function slist(){
        $map=array();
        $param = $this->request->param();
        $storeid=isset($param['storeid'])?$param['storeid']:'';
        if($storeid){
            $map['storeid']=$storeid;
        }
        $starttime=isset($param['start_time'])?$param['start_time']:'';
        $endtime=isset($param['end_time'])?$param['end_time']:'';
        if(!empty($starttime)){
            $map['ctime'][]=array('egt',strtotime($starttime));
        }
        if(!empty($endtime)){
            $map['ctime'][]=array('lt',24*60*60+strtotime($endtime));
        }
        //店铺列表
        $list_store_list=Db::name('Store')->where(array('status'=>0))->select()->toarray();//正在运营的店铺列表
        //各个查询条件
        $list=Db::name('TotalStatis')->where($map)->paginate(10);
        $page = $list->render();
        $this->assign("store_list", $list_store_list);
        $this->assign("page", $page);
        $this->assign("list", $list);
        return $this->fetch();
    }
}